module.exports = class extends saas.controller {
  async update1Action() {
    const res = await this.mysql.thenUpdate('saas_login_token_cache', {adminid: saas.uniqueId()}, {
      token: saas.uuid(),
      adminid: 8888,
      ttt: 111
    });
    console.log(res);
    return this.success(res);
  }
  
  async update2Action() {
    const res = await this.mysql('saas_login_token_cache')
      .where({id: 1}).update({token: saas.uuid(), ttt: 2});
    return this.success(res);
  }
  
  async update3Action() {
    const res = await this.mysql('saas_login_token_cache').thenUpdate({
      token: saas.uuid(),
      adminid: saas.uniqueId(),
      ttt: 111
    }, {adminid: 8888});
    console.log(res);
    return this.success(res);
  }
  
  async extendAction() {
    const res = await this.mysql('saas_login_token_cache').where('id', '>', 0).orderBy('id', 'desc').page(1, 10).countSelect();
    return this.success(res);
  }
  
  async tablenameAction() {
    return this.success({
      a: this.tableName('a'),
      b: this.tableName('b', true),
      c: this.tableName('c', false),
      d: this.tableName('d', 'e'),
    })
  }
}